home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Practical Algorithms for Image Analysis
/
Practical Algorithms for Image Analysis.iso
/
LIBIP
/
histogram.c
< prev
next >
Wrap
Text File
|
1999-09-11
|
616b
|
30 lines
/*
* histogram.c
*
* Practical Algorithms for Image Analysis
*
* Copyright (c) 1997, 1998, 1999 MLMSoftwareGroup, LLC
*/
/* HISTOGRAM: program calculates intensity histogram for input byte array
* usage: histogram(array,n,hist) */
#define INT(A) (((int)A)&0xff) /* character to integer conversion */
int
histogram (array, n, hist)
char *array; /* input data array */
int n, /* no. elements in input array */
*hist; /* I/O histogram array */
{
int i;
for (i = 0; i < n; i++)
hist[INT (*array++)]++;
return (0);
}